//
//  UIView+Extension.swift
//  weibo
//
//  Created by 王旭 on 16/4/17.
//  Copyright © 2016年 王旭. All rights reserved.
//

import UIKit

extension UIView {
    
    //线宽
    @IBInspectable var borderWidth :CGFloat {
        get{
            return layer.borderWidth
        }
        set{
            layer.borderWidth = newValue
        }
    }
    
    //线条颜色
    @IBInspectable var borderColor :UIColor? {
        get{
            if let bc = layer.borderColor {
                return UIColor(CGColor: bc)
            }
            return nil

        }
        set{
            layer.borderColor = newValue?.CGColor
        }
    }
    
    //圆角
    @IBInspectable var cornerRadius :CGFloat {
        get{
            return layer.cornerRadius
        }
        set{
            layer.cornerRadius = newValue
            clipsToBounds = (newValue > 0)
            
        }
    }
    
}
